package cn.edu.xmu.oomall.payment.model.vo;

import cn.edu.xmu.oomall.payment.model.bo.ErrorAccount;
import cn.edu.xmu.oomall.payment.util.DateTimeTransformation;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.ZonedDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ShopErrorAccountRetVo {
    @ApiModelProperty(value = "id")
    private Long id;
    @ApiModelProperty(value = "支付交易流水号")
    private String tradeSn;
    @ApiModelProperty(value = "支付渠道")
    private Long patternId;
    @ApiModelProperty(value = "收入金额（单位分）")
    private Long income;
    @ApiModelProperty(value = "支出金额（单位分）")
    private Long expenditure;
    @ApiModelProperty(value = "状态")
    private Byte state;
    @ApiModelProperty(value = "单据号")
    private String documentId;
    @ApiModelProperty(value = "账目时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd'T'HH:mm:ss.SSS" ,timezone = "GMT+8")
    private ZonedDateTime time;

    public ShopErrorAccountRetVo(ErrorAccount errorAccount) {
        id = errorAccount.getId();
        tradeSn = errorAccount.getTradeSn();
        patternId = errorAccount.getPatternId();
        income = errorAccount.getIncome();
        expenditure = errorAccount.getExpenditure();
        state = errorAccount.getState();
        documentId = errorAccount.getDocumentId();
        time = DateTimeTransformation.getZonedDateTime(errorAccount.getTime());
    }
}